/**
 * Created by zhaojm on 15/4/28.
 */
game.ScrollLayer = cc.LayerColor.extend({
    _world:null,
    ctor:function(world){
        this._super(new cc.Color(0, 0, 0));
        this.setContentSize(new cc.Size(100000, this.getContentSize().height));
        var winSize = cc.winSize;
        this._world = world;

        var platform = new game.Platform(cc.p(0, winSize.height / 3));
        this.addRole(platform);

        this._nailGenerator = new game.NailGenerator(this, this._world, platform);

    },

    start:function(){
        this.scheduleUpdate();
    },

    gameOver:function(){
        this.unscheduleUpdate();
    },

    update:function(dt){
        //this.x -= 100 * dt;
        //game._Camera.x = - this.x;
        this._nailGenerator.update(dt);
    },

    addRole:function(role){
        role.addToLayer(this, this._world);
    },

});